<template>
 <div>  
    <el-table :data="datavip" border style="width: 100%">
        <el-table-column prop="date" label="产品图片" width="130" align="center">
            <template v-slot="{row}">
                <el-avatar shape="square" :size="80" fit="scale-down" :src="row.imageUrl"></el-avatar>
            </template>
        </el-table-column>
        <el-table-column prop="productName" label="产品名称" width="180" align="center"></el-table-column>
        <el-table-column prop="description" label="产品描述" width="280" align="center"></el-table-column>
        <el-table-column prop="price" label="价格（元）" width="180" align="center"></el-table-column>
        <el-table-column prop="inventory" label="库存" width="180" align="center"></el-table-column>
        <el-table-column prop="date" label="操作" width="180" align="center" v-slot='{row}'>
            <el-button type="success" @click="chongzhi(row.product_id)">充值</el-button>
        </el-table-column>
    </el-table>
</div>
</template>

<script>
import * as api from '../../../../api/vipdd'

    export default {
    meta:{
        title:"vipCharge",
        name:'vip充值'

    },

    created(){
        this.getvipcz()
        // this.chongzhi()
    },

    data(){
        return{
            // 接收vip充值的结果数据
        datavip:[]
        }
    },

    methods:{
        // 获取vip充值
        getvipcz(){
            api.getvipcz()
                .then((res)=>{
                    console.log('vip充值',res);
                    this.datavip = res.data.data
                })
            
        },

        // 点击充值按钮事件
        chongzhi(product_id){
            api.chongzhi(product_id)
            .then((res)=>{
                console.log('下单',res);
            })
            // this.$router.push({path:'/preorder',query:{rowo}})

             this.$confirm('请确认您已满十八周岁并具有购买能力，是否确定购买?', '购买提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'success'
        }).then(() => {
          
            // type: 'success',
            // message: '删除成功!'
            this.$router.push({path:'/preorder',query:{product_id}})

        }).catch(() => {
          this.$message({
            type: 'error',
            message: '已取消删除'
          });          
        });


        }
    }
}

</script>




